package com.xtpt.disaster.bean;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;

@Component
public class TaskInfo implements Serializable {
    @ApiModelProperty(value = "任务id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long taskId;

    @ApiModelProperty(value = "作业id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long jobDetailId;

    @ApiModelProperty(value = "任务名称")
    private String taskName;

    @ApiModelProperty(value = "任务描述")
    private String taskDesc;

    @ApiModelProperty(value = "定时或周期任务的开始时间")
    private Date taskStarttime;

    @ApiModelProperty(value = "周期任务的结束时间")
    private Date taskEndtime;

    @ApiModelProperty(value = "任务执行的状态，成功SUCCESS(0)，失败ERROR(-1)，运行中RUNNING(1)")
    private Integer taskStatus;

    @ApiModelProperty(value = "任务备份类型：FULL(\"全量备份\", 0),\n" +
            "INCREMENT(\"增量备份\", 1);")
    private Integer taskBackupType;

    @ApiModelProperty(value = "执行备份任务的文件的类型,0数据库，1文件，2虚拟镜像")
    private Integer taskFileType;

    @ApiModelProperty(value = "任务的类型，备份BACKUP(0)，RECOVER(1)")
    private Integer taskType;

    @ApiModelProperty(value = "任务的执行类型，IMMEDIATELY(\"立刻执行任务\",0),\n" +
            "START_AT(\"在指定时间执行一次\",1),\n" +
            "CALENDAR_INTERVAL(\"日、周、月、年周期性执行\",2),\n" +
            "CORN(\"根据Corn表达式执行\",3);\n")
    private Integer taskExectype;

    @ApiModelProperty(value = "DAY(\"每日周期执行\",0),\n" +
            "WEEK(\"每周周期执行\",1),\n" +
            "MONTH(\"每月周期执行\",2),\n" +
            "YEAR(\"每年周期执行\",3);")
    private Integer taskUnit;

    @ApiModelProperty(value = "周期单位数")
    private Integer taskUnitCount;

    @ApiModelProperty(value = "数据库信息id")
    private Long dbId;

    @ApiModelProperty(value = "节点信息id")
    private Long nodeId;

    @ApiModelProperty(value = "节点ip")
    private String nodeIp;

    @ApiModelProperty(value = "任务文件的源文件路径，等同于备份文件信息表中的bpfSourcepath")
    private String taskClientPath;

    @ApiModelProperty(value = "任务信息表创建时间")
    private Date createTime;

    @ApiModelProperty(value = "任务信息表修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "旧的任务名称，在更新任务的时候使用")
    private String oldJobName;

    public TaskInfo(Long taskId, Long jobDetailId, String taskName, String taskDesc, Date taskStarttime, Date taskEndtime, Integer taskStatus, Integer taskBackupType, Integer taskFileType, Integer taskType, Integer taskExectype, Integer taskUnit, Integer taskUnitCount, Long dbId, Long nodeId, String nodeIp, String taskClientPath, Date createTime, Date updateTime, String oldJobName) {
        this.taskId = taskId;
        this.jobDetailId = jobDetailId;
        this.taskName = taskName;
        this.taskDesc = taskDesc;
        this.taskStarttime = taskStarttime;
        this.taskEndtime = taskEndtime;
        this.taskStatus = taskStatus;
        this.taskBackupType = taskBackupType;
        this.taskFileType = taskFileType;
        this.taskType = taskType;
        this.taskExectype = taskExectype;
        this.taskUnit = taskUnit;
        this.taskUnitCount = taskUnitCount;
        this.dbId = dbId;
        this.nodeId = nodeId;
        this.nodeIp = nodeIp;
        this.taskClientPath = taskClientPath;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.oldJobName = oldJobName;
    }

    /**
     * @Description: 无参构造方法
     * @Author: hpc
     * @Date: 2021/12/29 上午 10:24

     * @return: null
     **/
    public TaskInfo() {

    }

    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public Long getJobDetailId() {
        return jobDetailId;
    }

    public void setJobDetailId(Long jobDetailId) {
        this.jobDetailId = jobDetailId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskDesc() {
        return taskDesc;
    }

    public void setTaskDesc(String taskDesc) {
        this.taskDesc = taskDesc;
    }

    public Date getTaskStarttime() {
        return taskStarttime;
    }

    public void setTaskStarttime(Date taskStarttime) {
        this.taskStarttime = taskStarttime;
    }

    public Date getTaskEndtime() {
        return taskEndtime;
    }

    public void setTaskEndtime(Date taskEndtime) {
        this.taskEndtime = taskEndtime;
    }

    public Integer getTaskStatus() {
        return taskStatus;
    }

    public void setTaskStatus(Integer taskStatus) {
        this.taskStatus = taskStatus;
    }

    public Integer getTaskBackupType() {
        return taskBackupType;
    }

    public void setTaskBackupType(Integer taskBackupType) {
        this.taskBackupType = taskBackupType;
    }

    public Integer getTaskFileType() {
        return taskFileType;
    }

    public void setTaskFileType(Integer taskFileType) {
        this.taskFileType = taskFileType;
    }

    public Integer getTaskType() {
        return taskType;
    }

    public void setTaskType(Integer taskType) {
        this.taskType = taskType;
    }

    public Integer getTaskExectype() {
        return taskExectype;
    }

    public void setTaskExectype(Integer taskExectype) {
        this.taskExectype = taskExectype;
    }

    public Integer getTaskUnit() {
        return taskUnit;
    }

    public void setTaskUnit(Integer taskUnit) {
        this.taskUnit = taskUnit;
    }

    public Integer getTaskUnitCount() {
        return taskUnitCount;
    }

    public void setTaskUnitCount(Integer taskUnitCount) {
        this.taskUnitCount = taskUnitCount;
    }

    public Long getDbId() {
        return dbId;
    }

    public void setDbId(Long dbId) {
        this.dbId = dbId;
    }

    public Long getNodeId() {
        return nodeId;
    }

    public void setNodeId(Long nodeId) {
        this.nodeId = nodeId;
    }

    public String getNodeIp() {
        return nodeIp;
    }

    public void setNodeIp(String nodeIp) {
        this.nodeIp = nodeIp;
    }

    public String getTaskClientPath() {
        return taskClientPath;
    }

    public void setTaskClientPath(String taskClientPath) {
        this.taskClientPath = taskClientPath;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getOldJobName() {
        return oldJobName;
    }

    public void setOldJobName(String oldJobName) {
        this.oldJobName = oldJobName;
    }

    @Override
    public String toString() {
        return "TaskInfo{" +
                "taskId=" + taskId +
                ", jobDetailId=" + jobDetailId +
                ", taskName='" + taskName + '\'' +
                ", taskDesc='" + taskDesc + '\'' +
                ", taskStarttime=" + taskStarttime +
                ", taskEndtime=" + taskEndtime +
                ", taskStatus=" + taskStatus +
                ", taskBackupType=" + taskBackupType +
                ", taskFileType=" + taskFileType +
                ", taskType=" + taskType +
                ", taskExectype=" + taskExectype +
                ", taskUnit=" + taskUnit +
                ", taskUnitCount=" + taskUnitCount +
                ", dbId=" + dbId +
                ", nodeId=" + nodeId +
                ", nodeIp='" + nodeIp + '\'' +
                ", taskClientPath='" + taskClientPath + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", oldJobName='" + oldJobName + '\'' +
                '}';
    }
}